#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  flock_write.py
#       Author @  Huoty
#  Create date @  2016-06-01 13:16:52
#  Description @  
# *************************************************************

import fcntl

fd = open("test.txt", "r+")
fcntl.flock(fd, fcntl.LOCK_EX|fcntl.LOCK_NB)
print fd.readlines()
fd.write("aerfomasdf")

# Script starts from here


